#!/bin/sh --login

# An assumption is made that the qsub script will generate the $flagfile
# as the last step in that script

script=$1
flagfile=$2
project=$3

if test "$project" == ""; then
    project=dlaps
fi

rm -f $flagfile

echo "qsub -A $project $script"
      qsub -A $project $script

@prefix@/etc/wait_for_file.sh $flagfile 120 60

if [ -f $flagfile ]
    then
    echo successful completion of qsub_wait...
else
    echo ERROR: qsub_wait did not complete...
fi
